home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 21
/
Cream of the Crop 21 (Terry Blount) (October 1996).iso
/
os2
/
e33el2.zip
/
emacs
/
19.33
/
lisp
/
appt.el
< prev
next >
Wrap
Lisp/Scheme
|
1996-08-04
|
21KB
|
601 lines
;;; appt.el --- appointment notification functions.
;; Copyright (C) 1989, 1990, 1994 Free Software Foundation, Inc.
;; Author: Neil Mager <neilm@juliet.ll.mit.edu>
;; Maintainer: FSF
;; Keywords: calendar
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
;; Boston, MA 02111-1307, USA.
;;; Commentary:
;;
;; appt.el - visible and/or audible notification of
;; appointments from ~/diary file generated from
;; Edward M. Reingold's calendar.el.
;;
;;
;; Comments, corrections, and improvements should be sent to
;; Neil M. Mager
;; Net <neilm@juliet.ll.mit.edu>
;; Voice (617) 981-4803
;;;
;;; Thanks to Edward M. Reingold for much help and many suggestions,
;;; And to many others for bug fixes and suggestions.
;;;
;;;
;;; This functions in this file will alert the user of a
;;; pending appointment based on their diary file.
;;;
;;;
;;; ******* It is necessary to invoke 'display-time' ********
;;; ******* and 'diary' for this to work properly. ********
;;;
;;; A message will be displayed in the mode line of the emacs buffer
;;; and (if the user desires) the terminal will beep and display a message
;;; from the diary in the mini-buffer, or the user may select to
;;; have a message displayed in a new buffer.
;;;
;;; The variable 'appt-message-warning-time' allows the
;;; user to specify how much notice they want before the appointment. The
;;; variable 'appt-issue-message' specifies whether the user wants
;;; to to be notified of a pending appointment.
;;;
;;; In order to use, the following should be in your .emacs file in addition to
;;; creating a diary file and invoking calendar:
;;;
;;; Set some options
;;; (setq view-diary-entries-initially t)
;;; (setq appt-issue-message t)
;;;
;;; The following three lines are required:
;;; (display-time)
;;; (add-hook 'diary-hook 'appt-make-list)
;;;
;;;
;;; This is an example of what can be in your diary file:
;;; Monday
;;; 9:30am Coffee break
;;; 12:00pm Lunch
;;;
;;; Based upon the above lines in your .emacs and diary files,
;;; the calendar and diary will be displayed when you enter
;;; emacs and your appointments list will automatically be created.
;;; You will then be reminded at 9:20am about your coffee break
;;; and at 11:50am to go to lunch.
;;;
;;; Use describe-function on appt-check for a description of other variables
;;; that can be used to personalize the notification system.
;;;
;;; In order to add or delete items from todays list, use appt-add
;;; and appt-delete.
;;;
;;; Additionally, the appointments list is recreated automatically
;;; at 12:01am for those who do not logout every day or are programming
;;; late.
;;;
;;; Brief internal description - Skip this if your not interested!
;;;
;;; The function appt-check is run from the 'loadst' process which is started
;;; by invoking (display-time). A temporary function below modifies
;;; display-time-filter
;;; (from original time.el) to include a hook which will invoke appt-check.
;;; This will not be necessary in the next version of gnuemacs.
;;;
;;;
;;; The function appt-make-list creates the appointments list which appt-check
;;; reads. This is all done automatically.
;;; It is invoked from the function list-diary-entries.
;;;
;;; You can change the way the appointment window is created/deleted by
;;; setting the variables
;;;
;;; appt-disp-window-function
;;; and
;;; appt-delete-window-function
;;;
;;; For instance, these variables can be set to functions that display
;;; appointments in pop-up frames, which are lowered or iconified after
;;; appt-display-interval seconds.
;;;
;;; Code:
;; Make sure calendar is loaded when we compile this.
(require 'calendar)
(provide 'appt)
;;;###autoload
(defvar appt-issue-message t
"*Non-nil means check for appointments in the diary buffer.
To be detected, the diary entry must have the time
as the first thing on a line.")
;;;###autoload
(defvar appt-message-warning-time 12
"*Time in minutes before an appointment that the warning begins.")
;;;###autoload
(defvar appt-audible t
"*Non-nil means beep to indicate appointment.")
;;;###autoload
(defvar appt-visible t
"*Non-nil means display appointment message in echo area.")
;;;###autoload
(defvar appt-display-mode-line t
"*Non-nil means display minutes to appointment and time on the mode line.")
;;;###autoload
(defvar appt-msg-window t
"*Non-nil means display appointment message in another window.")
;;;###autoload
(defvar appt-display-duration 10
"*The number of seconds an appointment message is displayed.")
;;;###autoload
(defvar appt-display-diary t
"*Non-nil means to display the next days diary on the screen.
This will occur at midnight when the appointment list is updated.")
(defvar appt-time-msg-list nil
"The list of appointments for today.
Use `appt-add' and `appt-delete' to add and delete appointments from list.
The original list is generated from the today's `diary-entries-list'.
The number before each time/message is the time in minutes from midnight.")
(defconst max-time 1439
"11:59pm in minutes - number of minutes in a day minus 1.")
(defvar appt-display-interval 3
"*Number of minutes to wait between checking the appointment list.")
(defvar appt-buffer-name " *appt-buf*"
"Name of the appointments buffer.")
(defvar appt-disp-window-function 'appt-disp-window
"Function called to display appointment window.")
(defvar appt-delete-window-function 'appt-delete-window
"Function called to remove appointment window and buffer.")
(defun appt-check ()
"Check for an appointment and update the mode line.
Note: the time must be the first thing in the line in the diary
for a warning to be issued.
The format of the time can be either 24 hour or am/pm.
Example:
02/23/89
18:00 Dinner
Thursday
11:45am Lunch meeting.
The following variables control the action of the notification:
appt-issue-message
If T, the diary buffer is checked for appointments.
appt-message-warning-time
Variable used to determine if appointment message
should be displayed.
appt-audible
Variable used to determine if appointment is audible.
Default is t.
appt-visible
Variable used to determine if appointment message should be
displayed in the mini-buffer. Default is t.
appt-msg-window
Variable used to determine if appointment message
should temporarily appear in another window. Mutually exclusive
to appt-visible.
appt-display-duration
The number of seconds an appointment message
is displayed in another window.
appt-display-interval
The number of minutes to wait between checking the appointments
list.
appt-disp-window-function
Function called to display appointment window. You can customize
appt.el by setting this variable to a function different from the
one provided with this package.
appt-delete-window-function
Function called to remove appointment window and buffer. You can
customize appt.el by setting this variable to a function different
from the one provided with this package.
This function is run from the loadst process for display time.
Therefore, you need to have `(display-time)' in your .emacs file."
(if (or (=